#ifndef HISTORYRECORD_H
#define HISTORYRECORD_H

// #include "ui_browserview.h"
// #include "webview.h"
#include "login.h"

//#include "webview.h"

#include <QWidget>

//////
#include <QSqlDatabase>
#include <QDateTime>

#include <QVBoxLayout>
#include <QPushButton>


namespace Ui{
class HistoryRecord;
}

/*单例模式下的*/
/*饿汉模式*/
class HistoryRecord : public QWidget
{
    Q_OBJECT
public:
    void InitAll(QWidget *parent = nullptr);
    void InitDatabase();
    void InitTable();

    explicit HistoryRecord(QWidget *parent = nullptr);
    ~HistoryRecord();


    void AddOneHistoryRecord(QString time,QString title,QString url);
    void DeleteRecordIfExists(QString title,QString url);

    void ShowThisAccount();
    void ShowAllHistory();
    void ModelShowAllHistory();
    void DeleteOneHistoryRecord(int id);
    void DeleteAllHistoryRecord();

//    QPushButton *URL[100];
//    QPushButton *DELETE[100];

    // static historyrecord* MakeObj()
    // {
    //     return &HistoryRecordObj;
    // }


    QPushButton *DELETE[100];
    QPushButton *URL[100];

signals:
    void sendData(QString url);

private slots:
    void on_pushButton_clicked();

     void delete_one_record(int id,QString url,QString title);
     void open_one_record(int id,QString url);

private:
    Ui::HistoryRecord *ui;

    // HistoryRecord() = default;
    // ~HistoryRecord() = default;
    // HistoryRecord(const HistoryRecord&) = delete;
    // HistoryRecord(HistoryRecord&&) = delete;
    // HistoryRecord operator=(const HistoryRecord&) = delete;

    //单例对象
    // static HistoryRecord HistoryRecordObj;


};

// historyrecord historyrecord::HistoryRecordObj;

#endif // HISTORYRECORD_H
